package spring.factory;

import spring.model.BeanDefinition;

import java.util.HashMap;
import java.util.Map;

public class BeanDefinitonRegistry {

    private final Map<String, BeanDefinition> DEFINITIONS = new HashMap<>();

    public void registerBeanDefinition(BeanDefinition bd) {
        if (DEFINITIONS.containsKey(bd.getId())) {
            return;
        }
        DEFINITIONS.put(bd.getId(), bd);
    }

    public BeanDefinition getBeanDefinition(String beanName) {
        return DEFINITIONS.get(beanName);
    }

    public boolean containsBeanDefinition(String beanName) {
        return DEFINITIONS.containsKey(beanName);
    }
}

